import 'package:car_map/mode/spuare_type_mode.dart';
import 'package:car_map/page/res/colors.dart';
import 'package:car_map/page/routers/fluro_navigator.dart';
import 'package:car_map/page/squarepage/square_router.dart';
import 'package:car_map/widget/spuare_type_grived.dart';
import 'package:car_map/widget/square_type_life_item.dart';
import 'package:car_map/widget/square_type_life_row.dart';
import 'package:car_map/widget/square_type_title.dart';
import 'package:flutter/material.dart';

///广场
class SquarePage extends StatefulWidget {
  @override
  _squarePage createState() => _squarePage();
}

class _squarePage extends State<SquarePage> {

  List<SpuareTypeModel> spuareList;
  List<SpuareTypeModel> serviceList;
  List<SpuareTypeModel> lifeList;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    getInquireList();
    getServiceList();
    getLifeList();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('广场'),
        centerTitle: true,
      ),
      body: Container(
        padding: EdgeInsets.only(left: 10.0, right: 10.0),
        child:
        ListView(
          children: <Widget>[
            SpuareTypeTitle(
              title: '查一查',
              colorsText: Colors.lightBlueAccent,
            ),
            SpuareTypeGrived(
              spuare: spuareList,
            ),
            SpuareTypeTitle(
              title: '汽车生活',
              colorsText: Colors.deepOrangeAccent,
            ),
            SquareTypeLifeRow(),
            SpuareTypeTitle(
              title: '周边服务',
              colorsText: Colors.blue,
            ),
            SpuareTypeGrived(
              spuare: serviceList,
            ),
            SpuareTypeTitle(
              title: '生活服务',
              colorsText: Colors.green,
            ),
            SpuareTypeGrived(
              spuare: lifeList,
            ),
          ],
        ),
      ),
    );
  }

  //查一查数据信息
  List<SpuareTypeModel> getInquireList() {
   spuareList = new List();
    spuareList.add(new SpuareTypeModel(
        title: '实名认证', urlPath: 'square/ic_certification', currentIndex: 0));
    spuareList.add(new SpuareTypeModel(
        title: '手机在网时长', urlPath: 'square/ic_internet', currentIndex: 1));
    spuareList.add(new SpuareTypeModel(
        title: '网贷黑名单', urlPath: 'square/ic_online', currentIndex: 2));
    spuareList.add(new SpuareTypeModel(
        title: '银行卡四要素', urlPath: 'square/ic_bankcard', currentIndex: 3));
    spuareList.add(new SpuareTypeModel(
        title: '流量卡查询', urlPath: 'square/ic_sim', currentIndex: 4));
    spuareList.add(new SpuareTypeModel(
        title: '失信黑名单', urlPath: 'square/ic_lost', currentIndex: 5));
    spuareList.add(new SpuareTypeModel(
        title: '企业工商数据', urlPath: 'square/ic_enterprise', currentIndex: 6));

    return spuareList;
  }

  //周边服务
  List<SpuareTypeModel> getServiceList() {
    serviceList = new List();
    serviceList.add(new SpuareTypeModel(
        title: '加油站', urlPath: 'square/ic_oil', currentIndex: 7));
    serviceList.add(new SpuareTypeModel(
        title: '停车场', urlPath: 'square/ic_parking', currentIndex:8));
    serviceList.add(new SpuareTypeModel(
        title: '代驾服务', urlPath: 'square/ic_driving', currentIndex: 9));
    serviceList.add(new SpuareTypeModel(
        title: '洗车服务', urlPath: 'square/ic_carwash', currentIndex: 10));
    serviceList.add(new SpuareTypeModel(
        title: '4S店', urlPath: 'square/ic_4sshop', currentIndex: 11));
    serviceList.add(new SpuareTypeModel(
        title: '汽车服务', urlPath: 'square/ic_carservice', currentIndex:12));
    serviceList.add(new SpuareTypeModel(
        title: '汽车维修', urlPath: 'square/ic_carkeep', currentIndex: 13));
    serviceList.add(new SpuareTypeModel(
        title: '汽车凭租', urlPath: 'square/ic_rent', currentIndex: 14));

    return serviceList;
  }

  //生活服务
  List<SpuareTypeModel> getLifeList() {
    lifeList= new List();
    lifeList.add(new SpuareTypeModel(
        title: '美食', urlPath: 'square/ic_food', currentIndex:15));
    lifeList.add(new SpuareTypeModel(
        title: '景点', urlPath: 'square/id_attractions', currentIndex:16));
    lifeList.add(new SpuareTypeModel(
        title: '酒店', urlPath: 'square/ic_hotel', currentIndex:17));
    lifeList.add(new SpuareTypeModel(
        title: '银行', urlPath: 'square/id_bank', currentIndex: 18));
    lifeList.add(new SpuareTypeModel(
        title: '超市', urlPath: 'square/ic_supermarket', currentIndex:19));
    lifeList.add(new SpuareTypeModel(
        title: '药店', urlPath: 'square/ic_pharmacy', currentIndex:20));
    lifeList.add(new SpuareTypeModel(
        title: '咖啡店', urlPath: 'square/ic_coffee', currentIndex:21));
    lifeList.add(new SpuareTypeModel(
        title: '医院', urlPath: 'square/ic_hospital', currentIndex: 22));

    return lifeList;
  }
}
